{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>商城</span>
            <span class="icon-angle-right"></span>
            <span>商品管理</span>
            <span class="icon-angle-right"></span>
            <span>商品分类</span>
            <span class="icon-angle-right"></span>
            <span>{$info ? '编辑' : '添加'}分类</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                            <tr>
                                <th colspan="2">{$info ? '编辑' : '添加'}分类</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td width="15%"><label for="name">分类名称<em>*</em></label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="name" id="name" placeholder="请输入栏目名称" value="{$info.name}" /></td>
                            </tr>
                            <tr>
                                <td><label for="alias_name">分类别名</label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="alias_name" id="alias_name" placeholder="请输入分类别名" value="{$info.alias_name}" /></td>
                            </tr>
                            <tr hidden>
                                <td><label for="">父级分类</label></td>
                                <td>
                                    <div class="lay-select m-select-def">
                                        <select name="parent_id">
                                            <option value="0">根分类</option>
                                            {foreach name="categories" item="v"}
                                            <option value="{$v.id}"{if condition="$v['is_last']"} disabled{/if}{if condition="$info['parent_id'] eq $v['id']"} selected{/if}>{$v.html|html_entity_decode}|-{$v.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr hidden>
                                <td><label for="">所属商品模型</label></td>
                                <td>
                                    <div class="lay-select m-select-def">
                                        <select name="good_mods_id">
                                            <option value="0">请选择系统模型</option>
                                            {foreach name="goodMods" item="mod"}
                                            <option value="{$mod.id}"{if condition="$info['good_mods_id'] eq $mod['id']"} selected{/if}>{$mod.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr hidden>
                                <td><label for="">是否终极分类</label></td>
                                <td>
                                    <input type="radio" name="is_last" value="1" title="是"{if condition="!$info || $info['is_last'] eq 1"} checked{/if} />
                                    <input type="radio" name="is_last" value="0" title="否"{if condition="$info && $info['is_last'] eq 0"} checked{/if} />
                                </td>
                            </tr>
                            <tr hidden>
                                <td><label for="">分类封面图片</label></td>
                                <td>
                                    <button type="button" class="layui-btn u-upload-pic" data-name="image_id"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                                    <div class="m-pic">
                                        <ul>
                                            {:attach_html($info.image_id, 'image_id')}
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <tr hidden>
                                <td><label for="">分类广告图片</label></td>
                                <td>
                                    <button type="button" class="layui-btn u-upload-pic" data-name="ad_id"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                                    <div class="m-pic">
                                        <ul>
                                            {:attach_html($info.ad_id, 'ad_id')}
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <tr hidden>
                                <td><label for="ad_url">分类广告链接地址</label></td>
                                <td><input type="text" class="u-ipt u-ipt-long" name="ad_url" id="ad_url" placeholder="请输入分类广告链接地址" value="{$info.ad_url}" /></td>
                            </tr>
                            <tr hidden>
                                <td><label for="">是否首页推荐</label></td>
                                <td><div class="lay-checked"><input type="checkbox" name="is_home_recommand" value="1" title="是" lay-skin="primary"{$info.is_home_recommand ? ' checked' : ''} /></div></td>
                            </tr>
                            <tr>
                                <td><label for="">是否显示</label></td>
                                <td><div class="lay-checked"><input type="checkbox" name="is_show" value="1" title="是" lay-skin="primary"{$info.is_show ? ' checked' : ''} /></div></td>
                            </tr>
                            <tr>
                                <td><label for="list_order">排序</label></td>
                                <td><input type="text" class="u-ipt u-ipt-small" name="list_order" id="list_order" placeholder="请输入排序值" value="{$info.list_order|default=0}" /><span>值越大越排在前面</span></td>
                            </tr>
                            <tr >
                                <td><label for="smalltext">分类描述</label></td>
                                <td><div class="m-textarea"><textarea name="smalltext" class="u-tarea" id="smalltext" placeholder="请输入分类描述">{$info.smalltext}</textarea></div></td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="super_category_ids" value="{$info.super_category_ids}" /><input type="hidden" name="sub_category_ids" value="{$info.sub_category_ids}" /><input type="hidden" name="id" value="{$info.id}"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
{include file="public:upload"/}
{/block}